This disclosure relates generally to the field of database management. More particularly, but not by way of limitation, it relates to a technique for automatically generating Data Definition Language (DDL) statements based on database log entries.
In its most generic form, DDL refers to a computer language for defining data structures. As used in the context of modern database management systems (DBMS), DDL most often refers to a subset of the Structured Query Language (SQL) directed to the creation, modification and examination of a database's schema. Illustrative DDL statements include the CREATE object, DROP object and ALTER object statements.
In general, each operation executed by a DBMS is recorded in one or more log files. Further, execution of a single DDL statement (e.g., a DROP TABLE statement) can generate, cause or result in many (hundreds) of log entries. Now, from time to time it may be beneficial to replicate the action of one or more DDL statements (e.g., to perform a MIGRATE operation) or to back out inopportune DDL statements (e.g., to perform an UNDO operation). In the prior art, the ability to automatically generate MIGRATE and UNDO DDL is limited. For example, while some tools exist to generate DDL statements based on a single log entry or a snapshot of a database (e.g., a tablespace) at a certain time, such methods are unable to capture changes made to the database's schema over time so that UNDO DDL may be generated at a later time. Thus, it would be beneficial to provide a mechanism to automatically generate DDL statements based on multiple database log entries.